package com.molin.IOtest.objectStreamTest;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;

public class Demo2 {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        ObjectInputStream ois = new ObjectInputStream(new FileInputStream("D:\\IdeaProjects\\BasicCode\\mIdeaTest\\src\\com\\molin\\IOtest\\objectStreamTest\\pwd.txt"));
        User o = (User) ois.readObject();//readObject返回object类型，需要强转
        System.out.println(o.toString());
        ois.close();
    }
}
